﻿using System.Data;

namespace DAL
{
    public static class DalRecruitmentPlan
    {
        private static readonly clsConnect Cls = new clsConnect();
        #region[Get-Data]
        public static DataTable GetRecruitmentPlan(string keywords)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@KEYWORDS", keywords);
            return Cls.GetData("sp_Recruitment_Plan_Get");
        }
        public static DataTable GetRecruitmentPlanEdit(int id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Plan_ID", id);
            return Cls.GetData("sp_Recruitment_Plan_Get_Edit");
        }
        #endregion

        #region[Insert-Update-Delete]
        public static bool Insert(EtRecruitmentPlan obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Plan_Code", obj.Plan_Code);
            Cls.AddParameter("@Plan_Name", obj.Plan_Name);
            Cls.AddParameter("@IsActive", obj.IsActive);
            Cls.AddParameter("@Note", obj.Note);
            return Cls.ExecuteNonQuery("sp_Recruitment_Plan_Insert");
        }
        public static bool Update(EtRecruitmentPlan obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Plan_ID", obj.Plan_ID);
            Cls.AddParameter("@Plan_Code", obj.Plan_Code);
            Cls.AddParameter("@Plan_Name", obj.Plan_Name);
            Cls.AddParameter("@IsActive", obj.IsActive);
            Cls.AddParameter("@Note", obj.Note);
            return Cls.ExecuteNonQuery("sp_Recruitment_Plan_Update");
        }
        public static bool Delete(EtRecruitmentPlan obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Plan_ID", obj.Plan_ID);
            return Cls.ExecuteNonQuery("sp_Recruitment_Plan_Delete");
        }
        #endregion
    }
    public class EtRecruitmentPlan
    {
        public int Plan_ID { get; set; }
        public string Plan_Code { get; set; }
        public string Plan_Name { get; set; }
        public bool IsActive { get; set; }
        public string Note { get; set; }
    }
}